package com.batsoft.trade.util;

/**
 * @author <a href="mailto:hellohesir@gmail.com">Mr_He</a>
 * 2019/10/26 23:18
 */
public class KryoSerialize implements TradeSerialize {

    private Class type = Object.class;

    @Override
    public byte[] serialize(Object t) {
        return KryoUtil.writeObjectToByteArray(t);
    }

    @Override
    public Object unserialize(byte[] bytes) {
        return bytes != null ? KryoUtil.readObjectFromByteArray(bytes, type) : null;
    }
}
